package com.sheng.project.test.wechat;

import com.sheng.project.Application;
import com.sheng.project.service.WeChatService;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import javax.annotation.Resource;
import java.util.Map;

/**
 * @author by ls
 * @date 2023/8/11
 */
@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest(classes = {Application.class}, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
public class Sign {

    @Resource
    private WeChatService weChatService;

    @Test
    public void test01() {
        // 注意 URL 一定要动态获取，不能 hardcode
        String url = "https://cloud.eduservice.club/apps/logistics-app/";
        Map<String, String> ret = weChatService.jsapi(url);
        for (Map.Entry<String, String> entry : ret.entrySet()) {
            System.out.println(entry.getKey() + "：" + entry.getValue());
        }
    }
}
